<template>
  <div>
  <div style="border:1px solid black;width:98%;height:1px;margin-bottom:10px;">
    <!-- <el-form :inline="true" :model="dialogList" label-width="120px" class="demo-ruleForm"></el-form> -->
    </div>
      <h3 class="dialog-plate-title" style="margin-top: 15px;">
        <span>待选方案</span>
      </h3>
    <el-collapse v-model="createPlanActiveNames" @change="createPlanHandleChange">
      <el-collapse-item name="planTableArea">
        <el-table :data="planTableData" stripe border style="width: 100%" class="company-table">
          <el-table-column prop="weight" label="体重" sortable min-width="50"></el-table-column>
          <el-table-column prop="allTotal" label="全血总量" sortable min-width="50"></el-table-column>
          <el-table-column prop="epv" label="EPV" sortable min-width="50"></el-table-column>
          <el-table-column prop="hct" label="HCT" sortable min-width="50"></el-table-column>
          <el-table-column prop="leaveBl" label="允许离体全血占比" sortable min-width="50"></el-table-column>
          <el-table-column prop="targetHct" label="目标HCT" sortable min-width="50"></el-table-column>
          <el-table-column prop="leaveBlTotal" label="允许离体全血总量" sortable min-width="50"></el-table-column>
          <el-table-column prop="targetLeaveBlTotal" label="目标血浆去除总量" sortable min-width="50"></el-table-column>
          <el-table-column prop="sumLeaveBlTotal" label="累计工艺性血浆去除量" sortable min-width="50"></el-table-column>
          <el-table-column prop="singleLayerMax" label="单层最大出浆量" sortable min-width="50"></el-table-column>
          <el-table-column prop="hxbLeaveTotal" label="红细胞去除总量" sortable min-width="50"></el-table-column>
          <el-table-column prop="predictHxbLeaveCount" label="预估红细胞去除次数" sortable min-width="50"></el-table-column>
          <el-table-column prop="shineAllBlood" label="照射全血总量" sortable min-width="50"></el-table-column>
          <el-table-column fixed="right" label="操作" align="left" min-width="75">
            <template slot-scope="scope">
              <span v-if="scope.row.hid!=null">已下发</span>
              <span v-else><el-button  @click="submitUpdatePlan(scope.row)" type="text" size="small">下发方案</el-button></span>
            </template>         
          </el-table-column>
        </el-table>
    </el-collapse-item>
    <h3 class="dialog-plate-title" style="margin-top: 15px;"><span>接诊趋势</span></h3>
    <el-collapse-item name="5">
      <div :style="{width:clientWidth+'px',height:(autoHeight*3+30)+'px'}">
        <div id="lineTotlal" class="marginCenter" :style="{width:clientWidth-200+'px',height:autoHeight+'px'}"></div>
        <div id="lineXj" class="marginCenter" :style="{width:clientWidth-200+'px',height:autoHeight+'px'}"></div>
        <div id="lineHxb" class="marginCenter" :style="{width:clientWidth-200+'px',height:autoHeight+'px'}"></div>
      </div>
    </el-collapse-item>
    <br />
    <div id="createPlan" style="padding:10px;">
      <h3 class="dialog-plate-title" style="margin-top: 15px;">
        <span>方案拟定</span>
      </h3>
      <pePlan :providerNo="providerId"  :hid="hid" @sendDataToParent="getDataFromChild" ref="pePlan"></pePlan>
    </div>
  </el-collapse>
    <el-button type="primary" style="float:right;" @click="addPlanByDoctor">下发方案</el-button>
  </div>
</template>
<script>
import {insertPePlanConfirm,addPlanByDoctor} from "plugins/axios/inquiryRecord.js"
import pePlan from 'views/operationManage/components/interrogation/pePlan.vue';
import {mapState} from 'vuex'
export default {
  name:'programming',
  components:{
    pePlan
  },
  props:{
    hid:{
      type:[String,Number]
    },
    providerId:{
      type:[String,Number]
    },
    cValPlan:{
      type:[String,Number]
    }
  },
  data(){
    return {
      planTableData:[],
      dialogList:[],
      createPlanActiveNames:["planTableArea"]
    }
  },
  computed: {
    ...mapState({clientHeight:state=>state.common.clientHeight,clientWidth:state=>state.common.clientWidth}),
    autoHeight() {
      return this.clientHeight / 2 - 55;
    }
  },
  created(){},
  mounted(){},
  watch:{},
  methods:{
    init(){
      this.$refs.pePlan.init();
      this.$refs.pePlan.queryPePlanData();
    },
    //计算
    createPlanHandleChange(val) {
      let self = this;
      console.log(val);
    },
    getDataFromChild(val){
      let self = this;
      self.planTableData = val;
    },
    submitUpdatePlan(row){
      let self = this;
      row.hid = self.hid;
      insertPePlanConfirm(row).then(res=>{
         if(res){
           self.$message.success("下发成功");
         }
      });
    },
    addPlanByDoctor() {
      let self = this;
      addPlanByDoctor(self.providerId).then(res => {
        this.$message("ok", "成功");
      });
    },
  }
}
</script>
<style scoped>
</style>